home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
taropyon
/
znsplay
/
src
/
znsv02.c
< prev
Wrap
C/C++ Source or Header
|
1993-11-30
|
2KB
|
85 lines
/*************************************************************************
* UGOKUZANSU PLAYER
*************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <egb.h>
#include <ugoku.h>
#include "znsplay.h"
static v02_graph_init( int md, int xd, int yd )
{
int x, y;
FRAME fr;
if ( md < 1 )
md = 1;
else if ( md > 4 )
md = 4;
x = 320/md - xd/2;
if( x < 0 ) x = 0;
y = 240/md - yd/2;
if( y < 0 ) y = 0;
ZNS_cls();
if ( DspCtrl.page0 != 5 )
{
EGB_resolution(EgbPtr,0,5);
DspCtrl.page0 = 5;
DspCtrl.scinf[0].md = 5;
EGB_displayPage(EgbPtr,1,3);
page1_palette();
}
DSP_writePage(0);
ZNS_displayStart(2,md,md); /* 画面の拡大 */
ZNS_displayStart(3,xd,yd); /* 表示画面の大きさ */
ZNS_displayStart(0, x, y); /* 画面の表示開始位置 */
ZNS_displayStart(1, 0, 0);
fr.x1 = x * md;
fr.y1 = y * md;
fr.x2 = (x + xd) * md - 1;
fr.y2 = (y + yd) * md - 1;
ZNS_frame( &fr );
return (0);
}
int zns_play_v02( ZNSMOVE_T *znsmove )
{
int xd, yd, size, frame, error;
char *buffer;
if ( znsmove->mode == ZNS_MODE_MEMORY )
{
error = V02_memory_play_init(
znsmove->filename, ZnsNextCheck, &frame, &xd, &yd, &size );
} else
{
error = V02_disk_play_init(
znsmove->filename, ZnsNextCheck, &frame, &xd, &yd, &size );
}
if ( error ) return (error);
error = v02_graph_init( znsmove->expand, xd, yd );
if( error ) return error;
if ( (buffer = malloc( size )) == NULL )
return 7;
if ( znsmove->mode == ZNS_MODE_MEMORY )
error = V02_memory_play( buffer, znsmove->filename, 0, znsmove->wait );
else
error = V02_disk_play ( buffer, znsmove->filename, 0, znsmove->wait );
free( buffer );
return (error);
}